package cn.sxt.oop;

import java.util.Arrays;

/**
 * 冒泡排序
 */
public class BubbleSort {
    public static void main(String[] args) {
        int[] a = {2,1,0,3,6,7,8,4,5,9};
        int temp;
        for(int i=0; i<a.length; i++){
            boolean flag = true;
            for(int j=0; j<a.length-1-i; j++){
                if(a[j]>a[j+1]){
                 temp = a[j];
                 a[j] = a[j+1];
                 a[j+1] = temp;
                 flag = false;
                }
                System.out.println(Arrays.toString(a));
            }
            System.out.println("****************");
            if (flag){
                System.out.println("结束！");
                break;
            }
        }

    }
}
